Optimal. Leaf size=156 \[ \frac {2 (5 A-8 B) \tan (c+d x)}{3 a^2 d}-\frac {(4 A-7 B) \tanh ^{-1}(\sin (c+d x))}{2 a^2 d}+\frac {(5 A-8 B) \tan (c+d x) \sec ^2(c+d x)}{3 a^2 d (\sec (c+d x)+1)}-\frac {(4 A-7 B) \tan (c+d x) \sec (c+d x)}{2 a^2 d}+\frac {(A-B) \tan (c+d x) \sec ^3(c+d x)}{3 d (a \sec (c+d x)+a)^2} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.31, antiderivative size = 156, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 6, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.194, Rules used = {4019, 3787, 3767, 8, 3768, 3770} \[ \frac {2 (5 A-8 B) \tan (c+d x)}{3 a^2 d}-\frac {(4 A-7 B) \tanh ^{-1}(\sin (c+d x))}{2 a^2 d}+\frac {(5 A-8 B) \tan (c+d x) \sec ^2(c+d x)}{3 a^2 d (\sec (c+d x)+1)}-\frac {(4 A-7 B) \tan (c+d x) \sec (c+d x)}{2 a^2 d}+\frac {(A-B) \tan (c+d x) \sec ^3(c+d x)}{3 d (a \sec (c+d x)+a)^2} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 3767
Rule 3768
Rule 3770
Rule 3787
Rule 4019
Rubi steps
\begin {align*} \int \frac {\sec ^4(c+d x) (A+B \sec (c+d x))}{(a+a \sec (c+d x))^2} \, dx &=\frac {(A-B) \sec ^3(c+d x) \tan (c+d x)}{3 d (a+a \sec (c+d x))^2}+\frac {\int \frac {\sec ^3(c+d x) (3 a (A-B)-a (2 A-5 B) \sec (c+d x))}{a+a \sec (c+d x)} \, dx}{3 a^2}\\ &=\frac {(5 A-8 B) \sec ^2(c+d x) \tan (c+d x)}{3 a^2 d (1+\sec (c+d x))}+\frac {(A-B) \sec ^3(c+d x) \tan (c+d x)}{3 d (a+a \sec (c+d x))^2}+\frac {\int \sec ^2(c+d x) \left (2 a^2 (5 A-8 B)-3 a^2 (4 A-7 B) \sec (c+d x)\right ) \, dx}{3 a^4}\\ &=\frac {(5 A-8 B) \sec ^2(c+d x) \tan (c+d x)}{3 a^2 d (1+\sec (c+d x))}+\frac {(A-B) \sec ^3(c+d x) \tan (c+d x)}{3 d (a+a \sec (c+d x))^2}+\frac {(2 (5 A-8 B)) \int \sec ^2(c+d x) \, dx}{3 a^2}-\frac {(4 A-7 B) \int \sec ^3(c+d x) \, dx}{a^2}\\ &=-\frac {(4 A-7 B) \sec (c+d x) \tan (c+d x)}{2 a^2 d}+\frac {(5 A-8 B) \sec ^2(c+d x) \tan (c+d x)}{3 a^2 d (1+\sec (c+d x))}+\frac {(A-B) \sec ^3(c+d x) \tan (c+d x)}{3 d (a+a \sec (c+d x))^2}-\frac {(4 A-7 B) \int \sec (c+d x) \, dx}{2 a^2}-\frac {(2 (5 A-8 B)) \operatorname {Subst}(\int 1 \, dx,x,-\tan (c+d x))}{3 a^2 d}\\ &=-\frac {(4 A-7 B) \tanh ^{-1}(\sin (c+d x))}{2 a^2 d}+\frac {2 (5 A-8 B) \tan (c+d x)}{3 a^2 d}-\frac {(4 A-7 B) \sec (c+d x) \tan (c+d x)}{2 a^2 d}+\frac {(5 A-8 B) \sec ^2(c+d x) \tan (c+d x)}{3 a^2 d (1+\sec (c+d x))}+\frac {(A-B) \sec ^3(c+d x) \tan (c+d x)}{3 d (a+a \sec (c+d x))^2}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] time = 4.19, size = 496, normalized size = 3.18 \[ \frac {96 (4 A-7 B) \cos ^4\left (\frac {1}{2} (c+d x)\right ) \left (\log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )-\log \left (\sin \left (\frac {1}{2} (c+d x)\right )+\cos \left (\frac {1}{2} (c+d x)\right )\right )\right )+\sec \left (\frac {c}{2}\right ) \sec (c) \cos \left (\frac {1}{2} (c+d x)\right ) \sec ^2(c+d x) \left (-14 (A-B) \sin \left (\frac {d x}{2}\right )+(64 A-97 B) \sin \left (\frac {3 d x}{2}\right )-84 A \sin \left (c-\frac {d x}{2}\right )+42 A \sin \left (c+\frac {d x}{2}\right )-56 A \sin \left (2 c+\frac {d x}{2}\right )-6 A \sin \left (c+\frac {3 d x}{2}\right )+34 A \sin \left (2 c+\frac {3 d x}{2}\right )-36 A \sin \left (3 c+\frac {3 d x}{2}\right )+48 A \sin \left (c+\frac {5 d x}{2}\right )+6 A \sin \left (2 c+\frac {5 d x}{2}\right )+30 A \sin \left (3 c+\frac {5 d x}{2}\right )-12 A \sin \left (4 c+\frac {5 d x}{2}\right )+20 A \sin \left (2 c+\frac {7 d x}{2}\right )+6 A \sin \left (3 c+\frac {7 d x}{2}\right )+14 A \sin \left (4 c+\frac {7 d x}{2}\right )+126 B \sin \left (c-\frac {d x}{2}\right )-42 B \sin \left (c+\frac {d x}{2}\right )+98 B \sin \left (2 c+\frac {d x}{2}\right )+3 B \sin \left (c+\frac {3 d x}{2}\right )-37 B \sin \left (2 c+\frac {3 d x}{2}\right )+63 B \sin \left (3 c+\frac {3 d x}{2}\right )-75 B \sin \left (c+\frac {5 d x}{2}\right )-15 B \sin \left (2 c+\frac {5 d x}{2}\right )-39 B \sin \left (3 c+\frac {5 d x}{2}\right )+21 B \sin \left (4 c+\frac {5 d x}{2}\right )-32 B \sin \left (2 c+\frac {7 d x}{2}\right )-12 B \sin \left (3 c+\frac {7 d x}{2}\right )-20 B \sin \left (4 c+\frac {7 d x}{2}\right )\right )}{48 a^2 d (\cos (c+d x)+1)^2} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.45, size = 228, normalized size = 1.46 \[ -\frac {3 \, {\left ({\left (4 \, A - 7 \, B\right )} \cos \left (d x + c\right )^{4} + 2 \, {\left (4 \, A - 7 \, B\right )} \cos \left (d x + c\right )^{3} + {\left (4 \, A - 7 \, B\right )} \cos \left (d x + c\right )^{2}\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) - 3 \, {\left ({\left (4 \, A - 7 \, B\right )} \cos \left (d x + c\right )^{4} + 2 \, {\left (4 \, A - 7 \, B\right )} \cos \left (d x + c\right )^{3} + {\left (4 \, A - 7 \, B\right )} \cos \left (d x + c\right )^{2}\right )} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (4 \, {\left (5 \, A - 8 \, B\right )} \cos \left (d x + c\right )^{3} + {\left (28 \, A - 43 \, B\right )} \cos \left (d x + c\right )^{2} + 6 \, {\left (A - B\right )} \cos \left (d x + c\right ) + 3 \, B\right )} \sin \left (d x + c\right )}{12 \, {\left (a^{2} d \cos \left (d x + c\right )^{4} + 2 \, a^{2} d \cos \left (d x + c\right )^{3} + a^{2} d \cos \left (d x + c\right )^{2}\right )}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.29, size = 198, normalized size = 1.27 \[ -\frac {\frac {3 \, {\left (4 \, A - 7 \, B\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right )}{a^{2}} - \frac {3 \, {\left (4 \, A - 7 \, B\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right )}{a^{2}} + \frac {6 \, {\left (2 \, A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 5 \, B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 2 \, A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 3 \, B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}^{2} a^{2}} - \frac {A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 15 \, A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 21 \, B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{a^{6}}}{6 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [B] time = 0.68, size = 294, normalized size = 1.88 \[ \frac {\left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) A}{6 d \,a^{2}}-\frac {B \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{6 d \,a^{2}}+\frac {5 A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 d \,a^{2}}-\frac {7 B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 d \,a^{2}}-\frac {A}{d \,a^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}+\frac {5 B}{2 d \,a^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}+\frac {2 A \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d \,a^{2}}-\frac {7 \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) B}{2 d \,a^{2}}+\frac {B}{2 d \,a^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{2}}-\frac {A}{d \,a^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}+\frac {5 B}{2 d \,a^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}-\frac {2 A \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d \,a^{2}}+\frac {7 \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) B}{2 d \,a^{2}}-\frac {B}{2 d \,a^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{2}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [B] time = 0.36, size = 336, normalized size = 2.15 \[ -\frac {B {\left (\frac {6 \, {\left (\frac {3 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - \frac {5 \, \sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}}\right )}}{a^{2} - \frac {2 \, a^{2} \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}} + \frac {a^{2} \sin \left (d x + c\right )^{4}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{4}}} + \frac {\frac {21 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac {\sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}}}{a^{2}} - \frac {21 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + 1\right )}{a^{2}} + \frac {21 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - 1\right )}{a^{2}}\right )} - A {\left (\frac {\frac {15 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac {\sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}}}{a^{2}} - \frac {12 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + 1\right )}{a^{2}} + \frac {12 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - 1\right )}{a^{2}} + \frac {12 \, \sin \left (d x + c\right )}{{\left (a^{2} - \frac {a^{2} \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}}\right )} {\left (\cos \left (d x + c\right ) + 1\right )}}\right )}}{6 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 1.93, size = 166, normalized size = 1.06 \[ \frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (\frac {3\,\left (A-B\right )}{2\,a^2}+\frac {2\,A-4\,B}{2\,a^2}\right )}{d}-\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\,\left (2\,A-5\,B\right )-\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (2\,A-3\,B\right )}{d\,\left (a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4-2\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+a^2\right )}+\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\,\left (A-B\right )}{6\,a^2\,d}-\frac {\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )\,\left (4\,A-7\,B\right )}{a^2\,d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F] time = 0.00, size = 0, normalized size = 0.00 \[ \frac {\int \frac {A \sec ^{4}{\left (c + d x \right )}}{\sec ^{2}{\left (c + d x \right )} + 2 \sec {\left (c + d x \right )} + 1}\, dx + \int \frac {B \sec ^{5}{\left (c + d x \right )}}{\sec ^{2}{\left (c + d x \right )} + 2 \sec {\left (c + d x \right )} + 1}\, dx}{a^{2}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________